//
// Created by LanK on 2024/12/31.
//
#include <stdio.h>
#define N 20
int  match (char *exp){
  char stack[N];
  int top = -1;
    for (int i = 0; exp[i] != '\0'; i++) {
        char c = exp[i];
        if (c == '(' || c == '{' || c == '[') {
            stack[++top] = c;
        }else if (c == ')' || c == '}' || c == ']') {
            if (top == -1) {
                return 0;
            }
            char a = stack[top--];
            if (!(a == '(' && c == ')'|| a == '{' && c == '}'|| a == '[' && c == ']')) {
                return 0;
            }
        }
    }
    return top == -1 ? 1 : 0;
}

int main()
{
    char s[N];
    int flag;
    scanf("%s",s);
    flag=match(s);
    if(flag)
        printf("%s match",s);
    else
        printf("%s not match",s);
    return 0;
}

/* 请在这里填写答案 */